package com.cy.detectsys.entity;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Azure探测结果表
 * @TableName probe_result
 */
@TableName(value ="probe_result")
@Data
public class ProbeResult implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 任务ID
     */
    private String taskId;

    /**
     * 域名
     */
    private String domain;

    /**
     * IP
     */
    private String ip;

    /**
     * Host
     */
    private String hostName;

    /**
     * 基础协议
     */
    private String baseProtocol;

    /**
     * 协议
     */
    private String protocol;

    /**
     * 是否使用SSL
     */
    private Integer sslFlag;

    /**
     * Jarm
     */
    private String jarm;

    /**
     * TlsSuit
     */
    private String tlsSuit;

    /**
     * 证书信息
     */
    private String cert;

    /**
     * Banner
     */
    private String banners;

    /**
     * 指纹库匹配信息
     */
    private String matchResults;

    /**
     * 时间戳
     */
    private Date timestamp;

    /**
     *
     */
    private String port;

    /**
     * 云组件
     */
    private String product;

    /**
     *资产国家数量
     */
    @TableField(exist = false)
    private String  portCount;

    /**
     * 国家
     */
    @TableField(exist = false)
    private String  country;

    /**
     *独立ip数量
     */
    @TableField(exist = false)
    private String  ips;

    /**
     *数据中心资产数量
     */
    @TableField(exist = false)
    private String  protNum;

    /**
     *资产总数量
     */
    @TableField(exist = false)
    private String  protCountNum;

    /**
     *区域名称
     */
    @TableField(exist = false)
    private String  availableAreas;

    /**
     *区域资产统计
     */
    @TableField(exist = false)
    private String  areasNum;

    /**
     * 经度
     */
    @TableField(exist = false)
    private Double longitude;

    /**
     * 纬度
     */
    @TableField(exist = false)
    private Double latitude;

    @TableField(exist = false)
    private String cloudService;
//    @TableField(exist = false)
//    private List<Map<String, Object>> resultDetails;

    @TableField(exist = false)
    private JSONObject resultDetails;

    @TableField(exist = false)
    private String dataCenterName;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     *
     */
    public Long getId() {
        return id;
    }

    /**
     *
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 任务ID
     */
    public String getTaskId() {
        return taskId;
    }

    /**
     * 任务ID
     */
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    /**
     * 域名
     */
    public String getDomain() {
        return domain;
    }

    /**
     * 域名
     */
    public void setDomain(String domain) {
        this.domain = domain;
    }

    /**
     * IP
     */
    public String getIp() {
        return ip;
    }

    /**
     * IP
     */
    public void setIp(String ip) {
        this.ip = ip;
    }

    /**
     * Host
     */
    public String getHostName() {
        return hostName;
    }

    /**
     * Host
     */
    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    /**
     * 基础协议
     */
    public String getBaseProtocol() {
        return baseProtocol;
    }

    /**
     * 基础协议
     */
    public void setBaseProtocol(String baseProtocol) {
        this.baseProtocol = baseProtocol;
    }

    /**
     * 协议
     */
    public String getProtocol() {
        return protocol;
    }

    /**
     * 协议
     */
    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    /**
     * 是否使用SSL
     */
    public Integer getSslFlag() {
        return sslFlag;
    }

    /**
     * 是否使用SSL
     */
    public void setSslFlag(Integer sslFlag) {
        this.sslFlag = sslFlag;
    }

    /**
     * Jarm
     */
    public String getJarm() {
        return jarm;
    }

    /**
     * Jarm
     */
    public void setJarm(String jarm) {
        this.jarm = jarm;
    }

    /**
     * TlsSuit
     */
    public String getTlsSuit() {
        return tlsSuit;
    }

    /**
     * TlsSuit
     */
    public void setTlsSuit(String tlsSuit) {
        this.tlsSuit = tlsSuit;
    }

    /**
     * 证书信息
     */
    public String getCert() {
        return cert;
    }

    /**
     * 证书信息
     */
    public void setCert(String cert) {
        this.cert = cert;
    }

    /**
     * Banner
     */
    public String getBanners() {
        return banners;
    }

    /**
     * Banner
     */
    public void setBanners(String banners) {
        this.banners = banners;
    }

    /**
     * 指纹库匹配信息
     */
    public String getMatchResults() {
        return matchResults;
    }

    /**
     * 指纹库匹配信息
     */
    public void setMatchResults(String matchResults) {
        this.matchResults = matchResults;
    }

    /**
     * 时间戳
     */
    public Date getTimestamp() {
        return timestamp;
    }

    /**
     * 时间戳
     */
    public void setTimestamp(Date timestamp) {
        this.timestamp = timestamp;
    }

    /**
     *
     */
    public String getPort() {
        return port;
    }

    /**
     *
     */
    public void setPort(String port) {
        this.port = port;
    }

    /**
     * 云组件
     */
    public String getProduct() {
        return product;
    }

    /**
     * 云组件
     */
    public void setProduct(String product) {
        this.product = product;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ProbeResult other = (ProbeResult) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTaskId() == null ? other.getTaskId() == null : this.getTaskId().equals(other.getTaskId()))
            && (this.getDomain() == null ? other.getDomain() == null : this.getDomain().equals(other.getDomain()))
            && (this.getIp() == null ? other.getIp() == null : this.getIp().equals(other.getIp()))
            && (this.getHostName() == null ? other.getHostName() == null : this.getHostName().equals(other.getHostName()))
            && (this.getBaseProtocol() == null ? other.getBaseProtocol() == null : this.getBaseProtocol().equals(other.getBaseProtocol()))
            && (this.getProtocol() == null ? other.getProtocol() == null : this.getProtocol().equals(other.getProtocol()))
            && (this.getSslFlag() == null ? other.getSslFlag() == null : this.getSslFlag().equals(other.getSslFlag()))
            && (this.getJarm() == null ? other.getJarm() == null : this.getJarm().equals(other.getJarm()))
            && (this.getTlsSuit() == null ? other.getTlsSuit() == null : this.getTlsSuit().equals(other.getTlsSuit()))
            && (this.getCert() == null ? other.getCert() == null : this.getCert().equals(other.getCert()))
            && (this.getBanners() == null ? other.getBanners() == null : this.getBanners().equals(other.getBanners()))
            && (this.getMatchResults() == null ? other.getMatchResults() == null : this.getMatchResults().equals(other.getMatchResults()))
            && (this.getTimestamp() == null ? other.getTimestamp() == null : this.getTimestamp().equals(other.getTimestamp()))
            && (this.getPort() == null ? other.getPort() == null : this.getPort().equals(other.getPort()))
            && (this.getProduct() == null ? other.getProduct() == null : this.getProduct().equals(other.getProduct()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTaskId() == null) ? 0 : getTaskId().hashCode());
        result = prime * result + ((getDomain() == null) ? 0 : getDomain().hashCode());
        result = prime * result + ((getIp() == null) ? 0 : getIp().hashCode());
        result = prime * result + ((getHostName() == null) ? 0 : getHostName().hashCode());
        result = prime * result + ((getBaseProtocol() == null) ? 0 : getBaseProtocol().hashCode());
        result = prime * result + ((getProtocol() == null) ? 0 : getProtocol().hashCode());
        result = prime * result + ((getSslFlag() == null) ? 0 : getSslFlag().hashCode());
        result = prime * result + ((getJarm() == null) ? 0 : getJarm().hashCode());
        result = prime * result + ((getTlsSuit() == null) ? 0 : getTlsSuit().hashCode());
        result = prime * result + ((getCert() == null) ? 0 : getCert().hashCode());
        result = prime * result + ((getBanners() == null) ? 0 : getBanners().hashCode());
        result = prime * result + ((getMatchResults() == null) ? 0 : getMatchResults().hashCode());
        result = prime * result + ((getTimestamp() == null) ? 0 : getTimestamp().hashCode());
        result = prime * result + ((getPort() == null) ? 0 : getPort().hashCode());
        result = prime * result + ((getProduct() == null) ? 0 : getProduct().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", taskId=").append(taskId);
        sb.append(", domain=").append(domain);
        sb.append(", ip=").append(ip);
        sb.append(", hostName=").append(hostName);
        sb.append(", baseProtocol=").append(baseProtocol);
        sb.append(", protocol=").append(protocol);
        sb.append(", sslFlag=").append(sslFlag);
        sb.append(", jarm=").append(jarm);
        sb.append(", tlsSuit=").append(tlsSuit);
        sb.append(", cert=").append(cert);
        sb.append(", banners=").append(banners);
        sb.append(", matchResults=").append(matchResults);
        sb.append(", timestamp=").append(timestamp);
        sb.append(", port=").append(port);
        sb.append(", product=").append(product);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
